{% extends "base.html" %}
{% block ventas %}
    
	<h2>Venta de entradas</h2>

	<form action="/ventas" method="post">
	    {% csrf_token %}
	
		<input type="hidden" id="festivalSelected" value={{id_festival}}>
		<input type="hidden" id="nocheSelected" value={{id_noche}}>
		<input type="hidden" id="sectorSelected" value={{id_sector}}>
    
    	{{ festivalesForm }}
    	{{ fechasForm }}
    	{{ sectoresForm }}
	
	{% for sector in sectores %}
	<table id="tablaListado">
    	{% for fila in localidades.all %}
	    <tr>
	    	{% for butaca in fila.getButacas.all %}
	    		<td>
					<div id="wrapper" style="background-color: {{sector.getColor}}">
            			{% if  butaca.estado == 'disponible' %}
							<div class="second2 disponible " >
								<a href="{{site.name}}/seleccionar_localidad/{{butaca.id}}/{{fila.id}}/{{id_festival}}/{{id_noche}}/{{id_sector}}">
	            					<span class="ui-icon ui-icon-circle-triangle-e"></span>
							</div>
	        			{% else %}              
	        		    	<div class="second2 nodisponible "></div>
	        			{% endif%}
					</div>             
		    	</td>
	    	{% endfor %}
	    </tr>
        {% endfor %}
	</table>
	{% endfor %}
	
	<table border="1px" id="tablaEntradas">
		<thead>
			<tr>
				<th>Fila</th>
				<th>Butaca</th>
				<th>Importe Entrada Base</th>
				<th>Adic. por Categoria</th>
			</tr>
		</thead>
		<tbody id="body_tablaEntradas">
			{% for entrada in tablaEntradas %}
				<tr>
					<td>{{entrada.fila}}</td>
					<td>{{entrada.butaca}}</td>
					<td>{{entrada.importe}}</td>
					<td>{{entrada.adicional}}</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>
	
	    <input type="button" value="Comprar" onclick="window.location.href='{{site.name}}/adquirir_localidad'" />
	    <input type="button" value="Cancelar seleccion" onclick="window.location.href='{{site.name}}/">
	</form>

{% endblock %}
 
 